package com.clstu;

import java.util.Arrays;
import java.util.Comparator;

public class ArrayMethod {
    public static void main(String[] args) {
        Integer[] arr= {-5,6,5,3,4};
        Arrays.sort(arr);//已经排好序
        System.out.println(Arrays.toString(arr));//不是arr.toString()方法
        Arrays.sort(arr, new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                Integer i1=(Integer) o1;
                Integer i2=(Integer) o2;
                return i2-i1;
            }
        });
        System.out.println(Arrays.toString(arr));
    }
}
